package com.proactive.webapp.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.proactive.webapp.dao.DesignTagDAO;
import com.proactive.webapp.entity.DesignTag;

@Controller
public class DesignTagController {
	ApplicationContext context =  new ClassPathXmlApplicationContext("spring-module.xml");
	
	@RequestMapping(value = "/getDesignTag", method = RequestMethod.GET)
	public @ResponseBody List<DesignTag> getDesignTagList(int categoryID) throws Exception {
		DesignTagDAO designTagDAO = (DesignTagDAO) context.getBean("designTagDAO");
		List<DesignTag> tagList = new ArrayList<DesignTag>();
		tagList = designTagDAO.getTop(10, categoryID);
		
		return tagList;		
	}

}
